﻿#region Usings

using System.Linq;
using System.Windows;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;

#endregion

namespace ScrumTable.UI.View.Ink
{
    /// <summary>
    /// ScrumStroke
    /// </summary>
    public class LineStroke : ScrumStroke
    {

        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------
     
        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        public LineStroke(Point from, Point to, DrawingAttributes attributes) : base(new StylusPointCollection(new Point[] { from, to }), attributes) { }
     
        #endregion




        #region Methods

        /// <summary>
        /// Packs the stroke to ink stroke.
        /// </summary>
        protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            Point startPoint = new Point(StylusPoints.First().X, StylusPoints.First().Y);
            Point endPoint = new Point(StylusPoints.Last().X, StylusPoints.Last().Y);
            drawingContext.DrawLine(new Pen(new SolidColorBrush(drawingAttributes.Color), drawingAttributes.Height), startPoint, endPoint);
        }

        protected override StylusPointCollection Pack(Point from, Point to, double width, double height, StylusPointCollection collection)
        {
            collection.Add(StylusPoints.First());
            collection.Add(StylusPoints.Last());
            return collection;
        }
        #endregion
        #region Events

        #endregion
    }
}
